<template>
	<div class="content">
		<div class="poster">
			<div v-if="type == 3">
				<div class="type2">
					<div class="left">
						<img :src="list[0].url" class="left_img" mode="aspectFill" @click="toUrl(list[0].link)" />
					</div>
					<div class="right">
						<div class="right1">
							<img :src="list[1] ? list[1].url : ''" class="right_img" mode="aspectFill"
								@click="toUrl(list[1].link)" />
						</div>
						<div class="right1">
							<img :src="list[2] ? list[2].url : ''" class="right_img" mode="aspectFill"
								@click="toUrl(list[2].link)" />
						</div>
					</div>
				</div>
			</div>
			<div v-if="type == 2">
				<div class="type2">
					<div class="right">
						<div class="right1">
							<img :src="list[0].url" class="right_img" mode="aspectFill" @click="toUrl(list[0].link)" />
						</div>
						<div class="right1">
							<img :src="list[1] ? list[1].url : ''" class="right_img" mode="aspectFill"
								@click="toUrl(list[1].link)" />
						</div>
					</div>
					<div class="left">
						<img :src="list[2] ? list[2].url : ''" class="left_img" mode="aspectFill"
							@click="toUrl(list[2].link)" />
					</div>
				</div>
			</div>
			<div v-if="type == 1">
				<img :src="list[0].url" :style="{ height: list[0].height + 'px' }" class="type1" mode="aspectFill"
					@click="toUrl(list[0].link)" />
			</div>
		</div>
	</div>
</template>

<script>
export default {
	name: "poster",
	props: {
		type: {
			type: [String, Number],
			default: 1
		},
		list: {
			type: Array,
			default: () => []
		},

	},
	data() {
		return {

		};
	},
	created() {

	},
	methods: {
		toUrl(link) {
			let url = link
			var Tab = Tab = ['pages/index/index', '/pages/cat/cat', '/pages/personal/index']
			if (url == '' || url == '1') {
				// #ifndef  MP-WEIXIN
				// uni.showToast({
				// 	icon:'none',
				// 	title:'暂未开放'
				// })
				return false;
				//  #endif
			}
			if (Tab.indexOf(url) != -1) {
				uni.switchTab({
					url: url
				})
				return
			} else if (url.indexOf("www") >= 0 || url.indexOf("http") >= 0 || url.indexOf("https") >= 0) {
				uni.navigateTo({
					url: `/pages/company/skip?url=${url}`
				})
			} else {
				uni.navigateTo({
					url: url
				})
			}
		}
	}
}
</script>

<style lang="scss" scoped>
.content {
	padding: 5px 10px;
}

.type1 {
	width: 100%;
	height: auto;
	border-radius: 0px 0px 0px 0px;
}

.type2 {
	display: flex;
	justify-content: space-between;

	.left {
		width: 48%;
		height: 165px;

		.left_img {
			width: 100%;
			height: 165px;
			border-radius: 6px 6px 6px 6px;
		}
	}

	.right {
		display: flex;
		flex-direction: column;
		justify-content: space-between;
		width: 48%;

		.right_img {
			width: 100%;
			height: 78px;
			border-radius: 6px 6px 6px 6px;
		}
	}

	.right1 {
		width: 100%;
		height: 78px;
	}
}
</style>
